﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.Services;
using IntelligentAgriculture.WebAPI.Application.Command.DeathModelCommand;
using IntelligentAgriculture.WebAPI.Application.Command.SheepAblactationCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.DepartMentCommandHandier
{
    public class DeathModelCommandJamdier : IRequestHandler<DeathModelsCommand, Results<List<Sheepfilemodel>>>
    {
        private readonly iDeathModelService _iDeathModelService;

        public DeathModelCommandJamdier(iDeathModelService iDeathModelService) 
        {
            this._iDeathModelService = iDeathModelService;
        }

        public async Task<Results<List<Sheepfilemodel>>> Handle(DeathModelsCommand request, CancellationToken cancellationToken)
        {
            var list = await _iDeathModelService.GetBuildByEar(request.earTagNumber);
            return Results<List<Sheepfilemodel>>.DataResult(list);
        }
    }
}
